package com.mcay.springcloud.config;

import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.PredicateSpec;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.function.Function;
//gateway 编码网关配置
@Configuration
public class GatewayConfig {
    @Bean
    public RouteLocator customRoutelocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder routes=routeLocatorBuilder.routes();
        routes.route("path_route_mcay", r-> r.path("/guonei").uri("http://news.baidu.com/guonei"));
        return routes.build();
    }
}
